package com.xzy.ec.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class OrderVOo {

    @ApiModelProperty(value = "订单id")
    private Integer id;

    @ApiModelProperty(value = "用户id")
    private Integer userId;

    @ApiModelProperty(value = "商品id")
    private Integer goodsId;

    @ApiModelProperty(value = "用户姓名")
    private String userName;

    @ApiModelProperty(value = "手机号码")
    private String phone;

    @ApiModelProperty(value = "收货地址")
    private String deliveryAddr;

    @ApiModelProperty(value = "商品名称——冗余以减少连表")
    private String goodsName;

    @ApiModelProperty(value = "商品数量")
    private Integer goodsCount;

    @ApiModelProperty(value = "商品单价")
    private BigDecimal goodsPrice;

    @ApiModelProperty(value = "订单支付金额")
    private BigDecimal orderAmountTatal;

    @ApiModelProperty(value = "下单渠道 1.pc 2.android 3.iso")
    private Integer orderChannel;

    @ApiModelProperty(value = "订单状态 0新建未支付 1.已支付 2.已发货 3.已收货 4.已退款 5.已完成")
    private Integer status;

    @ApiModelProperty(value = "支付时间")
    @TableField("Pay_date")
    private LocalDateTime payDate;


    public OrderVOo beComeOrderVOo(OmsOrder o,UmsUserInfo umsUserInfo,String deliveryAddr){
        this.id=o.getId();
        this.userId=o.getUserId();
        this.goodsId=o.getGoodsId();
        this.userName=umsUserInfo.getNickname();
        this.phone=umsUserInfo.getPhone();
        this.deliveryAddr=deliveryAddr;
        this.goodsName=o.getGoodsName();
        this.goodsCount=o.getGoodsCount();
        this.goodsPrice=o.getGoodsPrice();
        this.orderAmountTatal=o.getOrderAmountTatal();
        this.orderChannel=o.getOrderChannel();
        this.status=o.getStatus();
        this.payDate=o.getPayDate();
        return  this;
    }

}
